import { PartialSwaggerObject } from '../../infrastructure/swagger-def';

export const swagger: PartialSwaggerObject = {
    paths: {
        '/auth/sendcaptcha': {
            post: {
                description: '发送验证码（邮箱/手机）',
                parameters: [
                    {
                        name: 'sendCaptchaParams',
                        in: 'body',
                        schema: {
                            required: ['username'],
                            properties: {
                                username: { type: 'string' },
                                retrieve: { type: 'boolean' }
                            }
                        },
                    },
                ],
                responses: {
                    '200': {
                        description: '成功',
                    },
                    '404': {
                        description: '账户不合法',
                    },
                    'default': {
                        description: '错误',
                        schema: { $ref: '#/definitions/ErrorResponse' }
                    }
                }
            }
        },
        '/auth/register': {
            post: {
                description: '用户注册成功',
                parameters: [
                    {
                        name: 'register',
                        in: 'body',
                        schema: {
                            required: ['username', 'password', 'captcha'],
                            properties: {
                                username: { type: 'string' },
                                password: { type: 'string' },
                                captcha: { type: 'string' },
                            }
                        },
                    },
                ],
                responses: {
                    '200': {
                        description: '成功'
                    },
                    '404': {
                        description: '账户不合法',
                    },
                    'default': {
                        description: '错误',
                        schema: { $ref: '#/definitions/ErrorResponse' }
                    }
                }
            }
        },
        '/auth/login': {
            post: {
                description: '发送验证码（邮箱/手机）',
                parameters: [
                    {
                        name: 'loginParams',
                        in: 'body',
                        schema: {
                            required: ['username', 'password'],
                            properties: {
                                username: { type: 'string' },
                                password: { type: 'string' }
                            }
                        },
                    },
                ],
                responses: {
                    '200': {
                        description: '成功',
                    },
                    '404': {
                        description: '账户不合法',
                    },
                    'default': {
                        description: '错误',
                        schema: { $ref: '#/definitions/ErrorResponse' }
                    }
                }
            }
        },
        '/auth/getbackpassword': {
            post: {
                description: '重置密码',
                parameters: [
                    {
                        name: 'sendCaptchaParams',
                        in: 'body',
                        schema: {
                            required: ['username', 'password', 'captcha'],
                            properties: {
                                username: { type: 'string' },
                                password: { type: 'string' },
                                captcha: { type: 'string' },
                            }
                        },
                    },
                ],
                responses: {
                    '200': {
                        description: '成功',
                    },
                    '404': {
                        description: '账户不合法',
                    },
                    'default': {
                        description: '错误',
                        schema: { $ref: '#/definitions/ErrorResponse' }
                    }
                }
            }
        },
        '/auth/appointment': {
            post: {
                description: '预约课程',
                parameters: [
                    {
                        name: 'appointmentClass',
                        in: 'body',
                        schema: {
                            required: ['name', 'phone', 'gradeType', 'grade', 'subject'],
                            properties: {
                                name: { type: 'string' },
                                phone: { type: 'string' },
                                gradeType: { type: 'string' },
                                grade: { type: 'string' },
                                subject: { type: 'string' },
                                referral: { type: 'string' }
                            }
                        },
                    },
                ],
                responses: {
                    '200': {
                        description: '成功',
                    },
                    '404': {
                        description: '账户不合法',
                    },
                    'default': {
                        description: '错误',
                        schema: { $ref: '#/definitions/ErrorResponse' }
                    }
                }
            }
        },
    },
    definitions: {},
    parameters: {}
};